package com.qp.bookkeeping.business.common.controller;

import com.qp.bookkeeping.business.common.model.rsp.DateQueryRsp;
import com.qp.bookkeeping.business.common.service.CommonService;
import com.qp.bookkeeping.common.model.rsp.BaseRsp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * @author xutianqi
 */
@RequestMapping("/common")
@RestController
public class CommonController {
    @Autowired
    CommonService commonService;

    @PostMapping("/queryDate")
    public <T> BaseRsp<DateQueryRsp> queryDate() {
        DateQueryRsp dateQueryRsp = commonService.queryData();
        return BaseRsp.success(dateQueryRsp);
    }

    @PostMapping("/createUUID")
    public <T> BaseRsp<String> createUUID() {
        return BaseRsp.success(UUID.randomUUID().toString().replaceAll("-", ""));
    }
}
